package com.khyr.feign;

import com.khyr.entity.Menu;
import com.khyr.entity.User;
import com.khyr.vo.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserFallbackFactory implements FallbackFactory<UserFeign> {
    @Override
    public UserFeign create(Throwable cause) {
        return new UserFeign() {
            @Override
            public R<User> getByName(String name) {
                return new R<User>(500,"服务器故障",null);
            }

            @Override
            public R<List<Menu>> getPermissionByUserId(Long userId) {
                return new R<List<Menu>>(500,"服务器故障",null);
            }
        };
    }
}
